import request from '@/utils/request'

// 系统菜单设置
export const getAllTreeInfo = () => {
  return request({
    url: '/menu/tree',
    method: 'get'
  })
}

export const deleteTreeItem = (id) => {
  return request({
    url: '/menu/' + id,
    method: 'delete'
  })
}
export const addTreeItem = (data) => {
  return request({
    url: '/menu',
    data,
    method: 'post'
  })
}
export const editTreeItem = (data) => {
  return request({
    url: '/menu',
    data,
    method: 'put'
  })
}
// 管理员账号
export const getAdministrator = (params) => {
  return request({
    url: '/employee',
    params,
    method: 'get'
  })
}
export const updateAdministrator = (data) => {
  return request({
    url: '/employee',
    data,
    method: 'put'
  })
}
export const addAdministrator = (data) => {
  return request({
    url: '/employee',
    data,
    method: 'post'
  })
}
export const deleteAdministrator = (id) => {
  return request({
    url: '/employee/' + id,
    method: 'delete'
  })
}
// 角色设置
export const getRoles = (params) => {
  return request({
    url: '/role',
    params,
    method: 'get'
  })
}
export const getRoleById = (id) => {
  return request({
    url: '/role/' + id,
    method: 'get'
  })
}
export const addRoles = (data) => {
  return request({
    url: '/role',
    data,
    method: 'post'
  })
}
export const updateRoles = (data) => {
  return request({
    url: '/role',
    data,
    method: 'put'
  })
}
export const deleteRoles = (id) => {
  return request({
    url: '/role/' + id,
    method: 'delete'
  })
}
export const getButton = (data) => {
  return request({
    url: '/menu/button',
    data,
    method: 'post'
  })
}
// 部门设置
export const getDepartment = () => {
  return request({
    url: '/department/tree',
    method: 'get'
  })
}
export const addDepartment = (data) => {
  return request({
    url: '/department',
    data,
    method: 'post'
  })
}
export const updateDepartment = (data) => {
  return request({
    url: '/department',
    data,
    method: 'put'
  })
}
export const deleteDepartment = (id) => {
  return request({
    url: '/department/' + id,
    method: 'delete'
  })
}
